<?php
/**
*
* @package phpBB3
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
 
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include_once($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include_once($phpbb_root_path . 'sv_common.' . $phpEx);
include_once($phpbb_root_path . 'ofc/php-ofc-library/open-flash-chart.' . $phpEx);


// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('stockvirtual');

$money = $user->data['user_money'];
$user_id 	= $user->data['user_id'];

if ($user_id == ANONYMOUS)
{
	sv_login_box();
}

display_forums('', $config['load_moderators']);



// list all delegation. 
$request_time = get_taiwan_time() - 14*24*60*60; // in 2 weeks
$sql 	= 'SELECT * FROM sv_transaction WHERE request_time>' . $request_time . " AND user_id IN ( SELECT followee_user_id FROM sv_follow_list WHERE follower_user_id = $user_id ) ORDER BY request_time DESC";
$result = $db->sql_query($sql); 
while ($row = $db->sql_fetchrow($result))
{
	if (is_valid_corp_id($row['corp_id']) == false)
	{
		continue;
	}
	
	$list = true;
	
	$deal_time = 0;
	if ((int)$row['deal_time'] != 0)
	{
		$deal_time = date('Y/m/d H:i', (int)$row['deal_time']);
	}
	
	// Send vars to template
	$template->assign_block_vars('list', array(		
		'USER_NAME'						=> get_username($row['user_id']),
		'USER_ID'						=> $row['user_id'],
		'CORP_ID'						=> $row['corp_id'],
		'CORP_NAME'						=> get_corp_chinese_name($row['corp_id']),
		'NUMBER'						=> (int)$row['share']/1000,
		'ACTION'						=> $row['action'],
		'REQUEST_TIME'					=> date('Y/m/d H:i', (int)$row['request_time']),
		'PRICE'							=> $row['price'],
		'DEAL_TIME'						=> $deal_time,
		)
	);
}




// include nav links.
include_nav_links();

// Assign index specific vars
$template->assign_vars(array(

	'FORUM_IMG'				=> $user->img('forum_read', 'NO_NEW_POSTS'),
	'FORUM_NEW_IMG'			=> $user->img('forum_unread', 'NEW_POSTS'),
	'FORUM_LOCKED_IMG'		=> $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
	'FORUM_NEW_LOCKED_IMG'	=> $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
	'JASON_STRING'			=> $jason_string,
	
	'S_LOGIN_ACTION'			=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
	'S_QUERY_USER'				=> append_sid("{$phpbb_root_path}query_user.$phpEx", 'mode=query_user'),
	
	'S_DISPLAY_BIRTHDAY_LIST'	=> ($config['load_birthdays']) ? true : false,
	'U_MONEY'					=> number_format($money),
	'S_PERFORMANCE'				=> $performance,
	'S_LIST'					=> $list,
	'S_EQUITY_CHANGE_LIST'		=> $equity_change_list,

	'U_MARK_FORUMS'		=> ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums') : '',
	'U_MCP'				=> ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '',
	
	'SHOW_1_MONTH_ROI'	=>	$show_1_month_roi,
	'SHOW_3_MONTH_ROI'	=>	$show_3_month_roi,
	'SHOW_6_MONTH_ROI'	=>	$show_6_month_roi,
	'SHOW_12_MONTH_ROI'	=>	$show_12_month_roi,
	'S_ROI_1_MONTH'		=>	$roi_1_month,
	'S_ROI_3_MONTH'		=>	$roi_3_month,
	'S_ROI_6_MONTH'		=>	$roi_6_month,
	'S_ROI_12_MONTH'	=>	$roi_12_month,
	
	'IN_FB_IFRAME'		=> $in_fb_iframe,
	)
);

// Output page
page_header($user->lang['SV_FOLLOW_INFO']);

$template->set_filenames(array(
	'body' => 'follow_info.html')
);

page_footer();

?>